import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';

const config: Config = {
  title: 'Open Docs',
  tagline: 'Learning Notes',
  favicon: 'img/logo.png',

  // Set the production url of your site here
  url: 'https://doc.jfyapp.com',
  // Set the /<baseUrl>/ pathname under which your site is served
  // For GitHub pages deployment, it is often '/<projectName>/'
  baseUrl: '/',

  // GitHub pages deployment config.
  // If you aren't using GitHub pages, you don't need these.
  organizationName: 'jfy', // Usually your GitHub org/user name.
  projectName: 'LearningNotes', // Usually your repo name.

  onBrokenLinks: 'throw',
  onBrokenMarkdownLinks: 'warn',

  // Even if you don't use internationalization, you can use this field to set
  // useful metadata like html lang. For example, if your site is Chinese, you
  // may want to replace "en" with "zh-Hans".
  i18n: {
    defaultLocale: 'zh-Hans',
    locales: ['zh-Hans'],
    path: '.'
  },

  presets: [
    [
      'classic',
      {
        docs: {
          sidebarPath: './sidebars.ts',
          // Please change this to your repo.
          // Remove this to remove the "edit this page" links.

        },
        blog: {
          showReadingTime: true,
          // Please change this to your repo.
          // Remove this to remove the "edit this page" links.

        },
        theme: {
          customCss: './src/css/custom.css',
        },
      } satisfies Preset.Options,
    ],
  ],


  themeConfig: {
    // Replace with your project's social card
    image: 'img/docusaurus-social-card.jpg',
    navbar: {
      title: 'Open Docs',
      logo: {
        alt: 'JFY',
        src: 'img/logo.png',
      },
      items: [
        {
          type: 'docSidebar',
          sidebarId: 'aiSidebar',
          position: 'left',
          label: 'AI',
        },
        {
          type: 'docSidebar',
          sidebarId: 'hardwareSidebar',
          position: 'left',
          label: '硬件',
        },
        {
          type: 'docSidebar',
          sidebarId: 'frontSidebar',
          position: 'left',
          label: '前端',
        },
        {
          type: 'docSidebar',
          sidebarId: 'middlewareSidebar',
          position: 'left',
          label: '中间件',
        },
        {
          type: 'docSidebar',
          sidebarId: 'toolSidebar',
          position: 'left',
          label: '工具',
        }
      ],
    },
    footer: {
      style: 'dark',
      copyright: `Copyright © ${new Date().getFullYear()} jfy, Inc. Built with Docusaurus.`,
    },
    prism: {
      additionalLanguages: ['bash', 'java', 'json', 'yaml', 'cpp', 'csharp'],
      theme: prismThemes.github,
      darkTheme: prismThemes.dracula,
    },
  } satisfies Preset.ThemeConfig,
  headTags: [
    // ... 你已有的其他 head 标签
    {
      tagName: "script",
      attributes: {},
      innerHTML: `
        <!-- 百度统计代码 -->

          var _hmt = _hmt || [];
          (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?29cf017e24b80b07083e58441cd567c9";
            var s = document.getElementsByTagName("script")[0]; 
            s.parentNode.insertBefore(hm, s);
          })();
     
      `,
    },
  ],
};

export default config;
